function MRIS_Tracker() {	
	var events = new Array("VIEW", "SAVE", "BRK_CLICK", "BRK_PHONE", "AGT_CLICK", "AGT_PHONE", "SOC_FBK", "SOC_MYS", "SOC_DEL");
	var host = "http://scout.mris.com";
	
	function AddObject(listingKey, mlsName, officeId, agentId, listingId) {
		listings[listingKey] = new listing(mlsName, officeId, agentId, listingId);
	}
	
	function AddListing(listingKey, mlsName, officeId, agentId, listingId) {
		AddObject(listingKey, mlsName, officeId, agentId, listingId);
	}
	
	function GetListing(listingKey) {
		return listings[listingKey];
	}
	
	function Exec(evtType, listingKey) {
		var lObj = this.GetListing(listingKey);
		var trackURL = host + "/t/" + lObj.mlsName + "/" + lObj.officeId + "/" + lObj.agentId + "/" + lObj.listingId + "/" + evtType + "/";
		var trackImg = new Image(1, 1);
		trackImg.onLoad = function() { };
		trackImg.src = trackURL;
		_breather(300);
		return true;
	}
	
	function _breather(dur) {
		var now = new Date();
		var end = now.getTime() + dur;
		while (now.getTime() < end) {
			now = new Date();
		}
	}

	var listings = new Array();

	function listing(p1, p2, p3, p4) {
		//this.mlsName = p1 ? p1 : "";
		this.mlsName = "MRIS"; // Temporary hardcoding to correct value. Remove if HDB serves multiple MLSes
		this.officeId = p2 ? p2 : "";
		this.agentId = p3 ? p3 : "";
		this.listingId = p4 ? p4 : "";
	}
	
	this.AddObject = AddObject;
	this.AddListing = AddListing;
	this.GetListing = GetListing;
	this.Exec = Exec;

}

var MRIS_T = new MRIS_Tracker();